﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Message/Message.master" AutoEventWireup="true" CodeBehind="MessageSent.aspx.cs" Inherits="HRdex_Final.Message.WebForm3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
  
    <div align="center">
  
    <asp:TextBox ID="TextBox1" runat="server" Width="168px"></asp:TextBox>
    <asp:Button ID="btnSearch"
        runat="server" Text="Search" onclick="btnSearch_Click" />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="3" DataKeyNames="MessageID" 
        DataSourceID="SentItems" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" BackColor="White" 
          BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" Width="697px" 
            AllowSorting="True">
        <Columns>
            <asp:BoundField DataField="MessageID" HeaderText="MessageID" 
                InsertVisible="False" ReadOnly="True" SortExpression="MessageID" 
                Visible="False" />
            <asp:ButtonField CommandName="Select" HeaderText="View" ShowHeader="True" 
                Text="View" />
                 <asp:BoundField DataField="fulname" HeaderText="To" 
                SortExpression="fulname" ReadOnly="True" />
            <asp:BoundField DataField="Subject" HeaderText="Subject" 
                SortExpression="Subject" />
            <asp:BoundField DataField="fromEmpID" HeaderText="fromEmpID" 
                SortExpression="fromEmpID" Visible="False" />
            <asp:BoundField DataField="DateTime" HeaderText="Date" 
                SortExpression="DateTime" />
           
            <asp:BoundField DataField="catMessegeName" HeaderText="Message Type" 
                SortExpression="catMessegeName" />
        </Columns>
        <FooterStyle BackColor="White" ForeColor="#000066" />
        <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
        <RowStyle ForeColor="#000066" />
        <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#007DBB" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#00547E" />
    </asp:GridView>
    <asp:SqlDataSource ID="SentItems" runat="server" 
        ConnectionString="<%$ ConnectionStrings:HRmainConnectionString %>" 
        
        
    SelectCommand="SELECT formMessegeSender.MessageID, formMessegeSender.Subject, formMessegeSender.fromEmpID, formMessegeSender.DateTime, formEmployees.LastName + ', ' + formEmployees.FirstName AS fulname, catMessege.catMessegeName FROM formMessegeSender INNER JOIN formEmployees ON formMessegeSender.EmployeeID = formEmployees.EmployeeID INNER JOIN catMessege ON formMessegeSender.catMessegeID = catMessege.catMessegeID WHERE (formMessegeSender.fromEmpID = @emp) ORDER BY formMessegeSender.DateTime DESC">
        <SelectParameters>
            <asp:SessionParameter Name="emp" SessionField="EmployeeID" />
        </SelectParameters>
    </asp:SqlDataSource>

    </div>
</asp:Content>
